/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package armazemseujose.view;

import armazemseujose.controller.armazemControl;
import java.io.FileNotFoundException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author BRUNA
 */
public class armazemSeuJoseView extends javax.swing.JFrame {

    private armazemControl controle;
    private cadastroCliente viewCliente;
    private cadastroItem viewItem;
    private cadastroVenda viewVenda;
    private cadastroCompra viewCompra;
    private estoque viewEstoque;
    private relatorioVendasCliente relatorioCliente;
    private relatorioVendasItem relatorioItem;
    private relatorioFinanceiro viewFinanceiro;
    private graficos graficos;

    public armazemSeuJoseView() throws FileNotFoundException {
        initComponents();
        controle = new armazemControl(this);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    public void novoItem() {
        setViewItem(new cadastroItem(this));
    }

    public void novoCliente() {
        setViewCliente(new cadastroCliente(this));
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuClienteCadastrar = new javax.swing.JMenu();
        jcadastrarCliente = new javax.swing.JMenuItem();
        jMenuItem = new javax.swing.JMenu();
        jMenuItemCadastrar = new javax.swing.JMenuItem();
        jMenuCompra = new javax.swing.JMenu();
        jMenuCompraCadastrar = new javax.swing.JMenuItem();
        jMenuVenda = new javax.swing.JMenu();
        jMenuVendaCadastrar = new javax.swing.JMenuItem();
        jMenuEstoque = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuRelatorios = new javax.swing.JMenu();
        vendaItem = new javax.swing.JMenuItem();
        vendaCliente = new javax.swing.JMenuItem();
        relatorioFinanceiro = new javax.swing.JMenuItem();
        jMenuGraficos = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        jMenu2.setText("File");
        jMenuBar2.add(jMenu2);

        jMenu3.setText("Edit");
        jMenuBar2.add(jMenu3);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Controle Armazém");
        setBackground(new java.awt.Color(255, 255, 255));
        setPreferredSize(new java.awt.Dimension(600, 400));

        jMenuClienteCadastrar.setText("Cliente");

        jcadastrarCliente.setText("Cadastrar");
        jcadastrarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcadastrarClienteActionPerformed(evt);
            }
        });
        jMenuClienteCadastrar.add(jcadastrarCliente);

        jMenuBar1.add(jMenuClienteCadastrar);

        jMenuItem.setText("Item");
        jMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemActionPerformed(evt);
            }
        });

        jMenuItemCadastrar.setText("Cadastrar");
        jMenuItemCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCadastrarActionPerformed(evt);
            }
        });
        jMenuItem.add(jMenuItemCadastrar);

        jMenuBar1.add(jMenuItem);

        jMenuCompra.setText("Compra");

        jMenuCompraCadastrar.setText("Cadastrar");
        jMenuCompraCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuCompraCadastrarActionPerformed(evt);
            }
        });
        jMenuCompra.add(jMenuCompraCadastrar);

        jMenuBar1.add(jMenuCompra);

        jMenuVenda.setText("Venda");

        jMenuVendaCadastrar.setText("Cadastrar");
        jMenuVendaCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuVendaCadastrarActionPerformed(evt);
            }
        });
        jMenuVenda.add(jMenuVendaCadastrar);

        jMenuBar1.add(jMenuVenda);

        jMenuEstoque.setText("Estoque");
        jMenuEstoque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuEstoqueActionPerformed(evt);
            }
        });

        jMenuItem1.setText("Itens em estoque");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenuEstoque.add(jMenuItem1);

        jMenuBar1.add(jMenuEstoque);

        jMenuRelatorios.setText("Relatórios");
        jMenuRelatorios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuRelatoriosActionPerformed(evt);
            }
        });

        vendaItem.setText("Relatório de Vendas por Item");
        vendaItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                vendaItemActionPerformed(evt);
            }
        });
        jMenuRelatorios.add(vendaItem);

        vendaCliente.setText("Relatório de Vendas por cliente");
        vendaCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                vendaClienteActionPerformed(evt);
            }
        });
        jMenuRelatorios.add(vendaCliente);

        relatorioFinanceiro.setText("Relatório Financeiro Simples");
        relatorioFinanceiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                relatorioFinanceiroActionPerformed(evt);
            }
        });
        jMenuRelatorios.add(relatorioFinanceiro);

        jMenuBar1.add(jMenuRelatorios);

        jMenuGraficos.setText("Gráficos");

        jMenuItem2.setText("Escolher gráfico");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenuGraficos.add(jMenuItem2);

        jMenuBar1.add(jMenuGraficos);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jcadastrarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcadastrarClienteActionPerformed
        setViewCliente(new cadastroCliente(this));
    }//GEN-LAST:event_jcadastrarClienteActionPerformed

    private void jMenuItemCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCadastrarActionPerformed
        setViewItem(new cadastroItem(this));
    }//GEN-LAST:event_jMenuItemCadastrarActionPerformed

    private void jMenuVendaCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuVendaCadastrarActionPerformed
        setViewVenda(new cadastroVenda(this));
    }//GEN-LAST:event_jMenuVendaCadastrarActionPerformed

    private void jMenuCompraCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuCompraCadastrarActionPerformed
        setViewCompra(new cadastroCompra(this));
    }//GEN-LAST:event_jMenuCompraCadastrarActionPerformed

    private void jMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemActionPerformed

    }//GEN-LAST:event_jMenuItemActionPerformed

    private void vendaItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vendaItemActionPerformed
        setRelatorioItem(new relatorioVendasItem(this));
    }//GEN-LAST:event_vendaItemActionPerformed

    private void jMenuEstoqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuEstoqueActionPerformed

    }//GEN-LAST:event_jMenuEstoqueActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        setViewEstoque(new estoque(this));
        getControle().estoque();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void vendaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vendaClienteActionPerformed
        setRelatorioCliente(new relatorioVendasCliente(this));
    }//GEN-LAST:event_vendaClienteActionPerformed

    private void relatorioFinanceiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relatorioFinanceiroActionPerformed
        setViewFinanceiro(new relatorioFinanceiro(this));
    }//GEN-LAST:event_relatorioFinanceiroActionPerformed

    private void jMenuRelatoriosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuRelatoriosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuRelatoriosActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        setGraficos(new graficos(this));
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(armazemSeuJoseView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(armazemSeuJoseView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(armazemSeuJoseView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(armazemSeuJoseView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new armazemSeuJoseView().setVisible(true);
                } catch (FileNotFoundException ex) {
                    Logger.getLogger(armazemSeuJoseView.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenu jMenuClienteCadastrar;
    private javax.swing.JMenu jMenuCompra;
    private javax.swing.JMenuItem jMenuCompraCadastrar;
    private javax.swing.JMenu jMenuEstoque;
    private javax.swing.JMenu jMenuGraficos;
    private javax.swing.JMenu jMenuItem;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItemCadastrar;
    private javax.swing.JMenu jMenuRelatorios;
    private javax.swing.JMenu jMenuVenda;
    private javax.swing.JMenuItem jMenuVendaCadastrar;
    private javax.swing.JMenuItem jcadastrarCliente;
    private javax.swing.JMenuItem relatorioFinanceiro;
    private javax.swing.JMenuItem vendaCliente;
    private javax.swing.JMenuItem vendaItem;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the controle
     */
    public armazemControl getControle() {
        return controle;
    }

    /**
     * @param controle the controle to set
     */
    public void setControle(armazemControl controle) {
        this.controle = controle;
    }

    /**
     * @return the jMenu2
     */
    public javax.swing.JMenu getjMenu2() {
        return jMenu2;
    }

    /**
     * @param jMenu2 the jMenu2 to set
     */
    public void setjMenu2(javax.swing.JMenu jMenu2) {
        this.jMenu2 = jMenu2;
    }

    /**
     * @return the jMenu3
     */
    public javax.swing.JMenu getjMenu3() {
        return jMenu3;
    }

    /**
     * @param jMenu3 the jMenu3 to set
     */
    public void setjMenu3(javax.swing.JMenu jMenu3) {
        this.jMenu3 = jMenu3;
    }

    /**
     * @return the jMenuBar1
     */
    public javax.swing.JMenuBar getjMenuBar1() {
        return jMenuBar1;
    }

    /**
     * @param jMenuBar1 the jMenuBar1 to set
     */
    public void setjMenuBar1(javax.swing.JMenuBar jMenuBar1) {
        this.jMenuBar1 = jMenuBar1;
    }

    /**
     * @return the jMenuBar2
     */
    public javax.swing.JMenuBar getjMenuBar2() {
        return jMenuBar2;
    }

    /**
     * @param jMenuBar2 the jMenuBar2 to set
     */
    public void setjMenuBar2(javax.swing.JMenuBar jMenuBar2) {
        this.jMenuBar2 = jMenuBar2;
    }

    /**
     * @return the jMenuClienteCadastrar
     */
    public javax.swing.JMenu getjMenuClienteCadastrar() {
        return jMenuClienteCadastrar;
    }

    /**
     * @param jMenuClienteCadastrar the jMenuClienteCadastrar to set
     */
    public void setjMenuClienteCadastrar(javax.swing.JMenu jMenuClienteCadastrar) {
        this.jMenuClienteCadastrar = jMenuClienteCadastrar;
    }

    /**
     * @return the jMenuCompra
     */
    public javax.swing.JMenu getjMenuCompra() {
        return jMenuCompra;
    }

    /**
     * @param jMenuCompra the jMenuCompra to set
     */
    public void setjMenuCompra(javax.swing.JMenu jMenuCompra) {
        this.jMenuCompra = jMenuCompra;
    }

    /**
     * @return the jMenuCompraCadastrar
     */
    public javax.swing.JMenuItem getjMenuCompraCadastrar() {
        return jMenuCompraCadastrar;
    }

    /**
     * @param jMenuCompraCadastrar the jMenuCompraCadastrar to set
     */
    public void setjMenuCompraCadastrar(javax.swing.JMenuItem jMenuCompraCadastrar) {
        this.jMenuCompraCadastrar = jMenuCompraCadastrar;
    }

    /**
     * @return the jMenuEstoque
     */
    public javax.swing.JMenu getjMenuEstoque() {
        return jMenuEstoque;
    }

    /**
     * @param jMenuEstoque the jMenuEstoque to set
     */
    public void setjMenuEstoque(javax.swing.JMenu jMenuEstoque) {
        this.jMenuEstoque = jMenuEstoque;
    }

    /**
     * @return the jMenuItem
     */
    public javax.swing.JMenu getjMenuItem() {
        return jMenuItem;
    }

    /**
     * @param jMenuItem the jMenuItem to set
     */
    public void setjMenuItem(javax.swing.JMenu jMenuItem) {
        this.jMenuItem = jMenuItem;
    }

    /**
     * @return the jMenuItem1
     */
    public javax.swing.JMenuItem getjMenuItem1() {
        return getJcadastrarCliente();
    }

    /**
     * @param jMenuItem1 the jMenuItem1 to set
     */
    public void setjMenuItem1(javax.swing.JMenuItem jMenuItem1) {
        this.setJcadastrarCliente(jMenuItem1);
    }

    /**
     * @return the jMenuItemCadastrar
     */
    public javax.swing.JMenuItem getjMenuItemCadastrar() {
        return jMenuItemCadastrar;
    }

    /**
     * @param jMenuItemCadastrar the jMenuItemCadastrar to set
     */
    public void setjMenuItemCadastrar(javax.swing.JMenuItem jMenuItemCadastrar) {
        this.jMenuItemCadastrar = jMenuItemCadastrar;
    }

    /**
     * @return the jMenuVenda
     */
    public javax.swing.JMenu getjMenuVenda() {
        return jMenuVenda;
    }

    /**
     * @param jMenuVenda the jMenuVenda to set
     */
    public void setjMenuVenda(javax.swing.JMenu jMenuVenda) {
        this.jMenuVenda = jMenuVenda;
    }

    /**
     * @return the jMenuVendaCadastrar
     */
    public javax.swing.JMenuItem getjMenuVendaCadastrar() {
        return jMenuVendaCadastrar;
    }

    /**
     * @param jMenuVendaCadastrar the jMenuVendaCadastrar to set
     */
    public void setjMenuVendaCadastrar(javax.swing.JMenuItem jMenuVendaCadastrar) {
        this.jMenuVendaCadastrar = jMenuVendaCadastrar;
    }

    /**
     * @return the viewCliente
     */
    public cadastroCliente getViewCliente() {
        return viewCliente;
    }

    /**
     * @param viewCliente the viewCliente to set
     */
    public void setViewCliente(cadastroCliente viewCliente) {
        this.viewCliente = viewCliente;
    }

    /**
     * @return the viewItem
     */
    public cadastroItem getViewItem() {
        return viewItem;
    }

    /**
     * @param viewItem the viewItem to set
     */
    public void setViewItem(cadastroItem viewItem) {
        this.viewItem = viewItem;
    }

    /**
     * @return the viewVenda
     */
    public cadastroVenda getViewVenda() {
        return viewVenda;
    }

    /**
     * @param viewVenda the viewVenda to set
     */
    public void setViewVenda(cadastroVenda viewVenda) {
        this.viewVenda = viewVenda;
    }

    /**
     * @return the viewCompra
     */
    public cadastroCompra getViewCompra() {
        return viewCompra;
    }

    /**
     * @param viewCompra the viewCompra to set
     */
    public void setViewCompra(cadastroCompra viewCompra) {
        this.viewCompra = viewCompra;
    }

    /**
     * @return the jcadastrarCliente
     */
    public javax.swing.JMenuItem getJcadastrarCliente() {
        return jcadastrarCliente;
    }

    /**
     * @param jcadastrarCliente the jcadastrarCliente to set
     */
    public void setJcadastrarCliente(javax.swing.JMenuItem jcadastrarCliente) {
        this.jcadastrarCliente = jcadastrarCliente;
    }

    /**
     * @return the viewEstoque
     */
    public estoque getViewEstoque() {
        return viewEstoque;
    }

    /**
     * @param viewEstoque the viewEstoque to set
     */
    public void setViewEstoque(estoque viewEstoque) {
        this.viewEstoque = viewEstoque;
    }

    /**
     * @return the jMenuGraficos
     */
    public javax.swing.JMenu getjMenuGraficos() {
        return jMenuGraficos;
    }

    /**
     * @param jMenuGraficos the jMenuGraficos to set
     */
    public void setjMenuGraficos(javax.swing.JMenu jMenuGraficos) {
        this.jMenuGraficos = jMenuGraficos;
    }

    /**
     * @return the jMenuRelatorios
     */
    public javax.swing.JMenu getjMenuRelatorios() {
        return jMenuRelatorios;
    }

    /**
     * @param jMenuRelatorios the jMenuRelatorios to set
     */
    public void setjMenuRelatorios(javax.swing.JMenu jMenuRelatorios) {
        this.jMenuRelatorios = jMenuRelatorios;
    }

    /**
     * @return the relatorioFinanceiro
     */
    public javax.swing.JMenuItem getRelatorioFinanceiro() {
        return relatorioFinanceiro;
    }

    /**
     * @param relatorioFinanceiro the relatorioFinanceiro to set
     */
    public void setRelatorioFinanceiro(javax.swing.JMenuItem relatorioFinanceiro) {
        this.relatorioFinanceiro = relatorioFinanceiro;
    }

    /**
     * @return the vendaCliente
     */
    public javax.swing.JMenuItem getVendaCliente() {
        return vendaCliente;
    }

    /**
     * @param vendaCliente the vendaCliente to set
     */
    public void setVendaCliente(javax.swing.JMenuItem vendaCliente) {
        this.vendaCliente = vendaCliente;
    }

    /**
     * @return the vendaItem
     */
    public javax.swing.JMenuItem getVendaItem() {
        return vendaItem;
    }

    /**
     * @param vendaItem the vendaItem to set
     */
    public void setVendaItem(javax.swing.JMenuItem vendaItem) {
        this.vendaItem = vendaItem;
    }

    /**
     * @return the relatorioCliente
     */
    public relatorioVendasCliente getRelatorioCliente() {
        return relatorioCliente;
    }

    /**
     * @param relatorioCliente the relatorioCliente to set
     */
    public void setRelatorioCliente(relatorioVendasCliente relatorioCliente) {
        this.relatorioCliente = relatorioCliente;
    }

    /**
     * @return the relatorioItem
     */
    public relatorioVendasItem getRelatorioItem() {
        return relatorioItem;
    }

    /**
     * @param relatorioItem the relatorioItem to set
     */
    public void setRelatorioItem(relatorioVendasItem relatorioItem) {
        this.relatorioItem = relatorioItem;
    }

    /**
     * @return the viewFinanceiro
     */
    public relatorioFinanceiro getViewFinanceiro() {
        return viewFinanceiro;
    }

    /**
     * @param viewFinanceiro the viewFinanceiro to set
     */
    public void setViewFinanceiro(relatorioFinanceiro viewFinanceiro) {
        this.viewFinanceiro = viewFinanceiro;
    }

    /**
     * @return the jMenuItem2
     */
    public javax.swing.JMenuItem getjMenuItem2() {
        return jMenuItem2;
    }

    /**
     * @param jMenuItem2 the jMenuItem2 to set
     */
    public void setjMenuItem2(javax.swing.JMenuItem jMenuItem2) {
        this.jMenuItem2 = jMenuItem2;
    }

    /**
     * @return the graficos
     */
    public graficos getGraficos() {
        return graficos;
    }

    /**
     * @param graficos the graficos to set
     */
    public void setGraficos(graficos graficos) {
        this.graficos = graficos;
    }
}
